package com.foreveross.taskservice.application.task.service;

import java.util.Date;
import java.util.List;

import com.foreveross.taskservice.application.IBaseJpaApplication;
import com.foreveross.taskservice.core.domain.task.TaskLine;
import com.foreveross.taskservice.core.domain.task.TaskTemplateEntity;

/**
 * 针对任务模版的接口
 * @author Administrator
 *
 */
public interface ITaskTemplateApplication extends IBaseJpaApplication{
	
	/**
	 * 获取所有的航线（PEK+CAN）
	 * @return
	 * @throws Exception
	 */
	public List<TaskLine> getAllLines()throws Exception;
	/**
	 * 重置所有模版下次抓取的时间
	 * @param nextTime
	 * @throws Exception
	 */
	public void updateAllTemplateNextGrabTime(Date nextTime)throws Exception;
	
	/**
	 * 重置某渠道下面的所有模版
	 * @param nextTime
	 * @param channelId
	 * @throws Exception
	 */
	public void updateChannelTemplateNextGrabTime(Date nextTime,String channelCode)throws Exception;
	
	
	/**
	 * 按优先级倒序取出模版
	 * @param maxSize
	 * @return
	 * @throws Exception
	 */
	public List<TaskTemplateEntity> getTaskTemplatesOrderPriorityDesc(int maxSize)throws Exception;
	
	
	/**
	 * 按渠道取出,优先级倒序取出模版
	 * 调用此方法，哪怕当前渠道属于不可用状态，仍然会取出对应的模版
	 * @param maxSize
	 * @return
	 * @throws Exception
	 */
	public List<TaskTemplateEntity> getTaskTemplatesOrderPriorityDesc(int templateMaxSize,String channelCode)throws Exception;
	/**
	 * 获得比当前优先级更高的所有模板
	 * @param priority
	 * @return
	 * @throws Exception
	 */
	public List<TaskTemplateEntity> getTaskTemplatesGreaterThanPriority(int priority,String channelCode)throws Exception;
}
